package com.kcht.itsed.mws.subscribescheduler.comm;

import com.kcht.itsed.mws.subscribescheduler.biz.IConcreteReportSender;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.io.InputStream;

/**
 * 桩发送器，直接打印
 * @author zhangwenshuo
 *
 */
@Slf4j
public class MockReportSender implements IConcreteReportSender {

	private String url,info;
	
	public MockReportSender(String url, String info) {
		this.url = url;
		this.info = info;
	}


	@Override
	public void send(InputStream reportIS) {
		byte[] rb = new byte[2048];
		try {
			reportIS.read(rb);
		} catch (IOException e) {
			log.error("",e);
		}
		log.info(info+":to:"+url+":"+new String(rb));
	}


	@Override
	public ReportSendingState getSendingState() {
		return ReportSendingState.SENDING;
	}

}
